﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace OCR
{
    public partial class About : Form, MessageBoxInterface
    {
        public About()
        {
            InitializeComponent();
        }

        private void About_Load(object sender, EventArgs e)
        {
            if (!File.Exists(OCR.MachineCodeFile))
            {
                Process.Start("HID.EXE");
            }
            this.tbMachineCode.Text = File.ReadAllText(OCR.MachineCodeFile); //机器码

            LoadLicenseFile();
        }
        private void btOk_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void LoadLicenseFile()
        {
            if (License.Status.Licensed)
            {
                this.lbStatus.Text = "有效";
                for (int i = 0; i < License.Status.KeyValueList.Count; i++)
                {
                    this.lbAdditional.Text += License.Status.KeyValueList.GetKey(i).ToString() + ":" + License.Status.KeyValueList.GetByIndex(i).ToString() + Environment.NewLine;
                }
            }
            else
            {
                this.lbStatus.Text = "无效";
            }
            if (License.Status.Evaluation_Lock_Enabled)
            {
                this.lbEvaluationDay.Text = License.Status.Evaluation_Time.ToString();
                this.lbUsedEvaluationDay.Text = License.Status.Evaluation_Time_Current.ToString();
            }
        }
        public string MessageBoxCaption
        {
            get
            {
                return this.Text;
            }
            set
            {
                this.Text = value;
            }
        }
        public string MessageBoxText
        {
            get
            {
                return this.lbMessage.Text;
            }
            set
            {
                this.lbMessage.Text = value;
            }
        }
        private Color messageBoxGradientBegin;

        public Color MessageBoxGradientBegin
        {
            get
            {
                return this.messageBoxGradientBegin;
            }
            set
            {
                this.messageBoxGradientBegin = value;
            }
        }
        private Color messageBoxGradientEnd;
        public Color MessageBoxGradientEnd
        {
            get
            {
                return this.messageBoxGradientEnd;
            }
            set
            {
                this.messageBoxGradientEnd = value;
            }
        }
    }
}
